﻿using PetaPoco;
using PmSoft;
using PmSoft.Caching;
using System.ComponentModel;
using static Modules.Person.PersonConstants;

namespace Modules.Project.Entitys
{
    /// <summary>
    /// 组成员信息表
    ///</summary>
    [TableName("project_group_member")]
    [Description("项目劳务班组人员信息")]
    [PrimaryKey("id", AutoIncrement = true)]
    [CacheSetting(true, PropertyNamesOfArea = "GroupId,PersonId")]
    [Serializable]
    public class ProjectGroupMember : IEntity
    {
        /// <summary>
        /// ID
        ///</summary>
        [Column("id")]
        public int Id { get; set; }

        /// <summary>
        /// 项目id
        ///</summary>
        [Column("project_id")]
        public int ProjectId { get; set; }

        /// <summary>
        /// 劳务班组ID
        ///</summary>
        [Column("group_id")]
        public int GroupId { get; set; }

        /// <summary>
        /// 企业Id
        ///</summary>
        [Column("corp_id")]
        public int CorpId { get; set; }

        /// <summary>
        /// 人员ID
        ///</summary>
        [Column("person_id")]
        public int PersonId { get; set; }

        /// <summary>
        /// 当前工种  参考工人工种字典表
        ///</summary>
        [Column("type")]
        public 工人工种? Type { get; set; }

        /// <summary>
        /// 岗位类型
        /// </summary>
        [Column("post_category")]
        public 管理岗位类型? PostCategory { get; set; }

        /// <summary>
        /// 是否班组长 参考是否字典表
        ///</summary>
        [Column("is_leader")]
        public bool? IsLeader { get; set; }

        /// <summary>
        /// 开始工作日期
        /// </summary>
        [Column("work_date")]
        public DateTime? WorkDate { get; set; }

        /// <summary>
        /// 创建时间
        ///</summary>
        [Column("create_time")]
        public DateTime? CreateTime { get; set; }

        /// <summary>
        /// 发卡时间
        ///</summary>
        [Column("issue_card_date")]
        public DateTime? IssueCardDate { get; set; }

        /// <summary>
        /// 办卡采集相片
        ///</summary>
        [Column("issue_card_pic")]
        public string? IssueCardPic { get; set; }

        /// <summary>
        /// 进场日期
        ///</summary>
        [Column("start_date")]
        public DateTime? StartDate { get; set; }

        /// <summary>
        /// 出场日期
        ///</summary>
        [Column("end_date")]
        public DateTime? EndDate { get; set; }

        /// <summary>
        /// 人员状态(1:在场 0:离场)
        ///</summary>
        [Column("status")]
        public 进出场状态 Status { get; set; }

        /// <summary>
        /// 是否现场管理人员
        ///</summary>
        [Column("is_manager")]
        public bool IsManager { get; set; }

        #region IEntity 成员

        [Ignore]
        object IEntity.EntityId { get { return Id; } }

        #endregion IEntity 成员
    }
}